VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "mscomctl.OCX"
Begin VB.Form FrmPersoHematologias 
   Caption         =   "Personalizar Hematologia - Cerrado"
   ClientHeight    =   8040
   ClientLeft      =   3660
   ClientTop       =   3765
   ClientWidth     =   12255
   LinkTopic       =   "Form1"
   ScaleHeight     =   8040
   ScaleWidth      =   12255
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.CommandButton Command5 
      Caption         =   "Bajar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   10380
      TabIndex        =   5
      Top             =   5340
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Subir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   10410
      TabIndex        =   4
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Nuevo"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   12000
      TabIndex        =   3
      Top             =   9600
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6000
      TabIndex        =   2
      Top             =   13560
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   13560
      TabIndex        =   0
      Top             =   9600
      Width           =   1215
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   9015
      Left            =   180
      TabIndex        =   1
      Top             =   315
      Width           =   10125
      _ExtentX        =   17859
      _ExtentY        =   15901
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FlatScrollBar   =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      HotTracking     =   -1  'True
      TextBackground  =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   16777215
      BorderStyle     =   1
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   2
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "Opcion"
         Object.Width           =   5292
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "Valor"
         Object.Width           =   8819
      EndProperty
   End
End
Attribute VB_Name = "FrmPersoHematologias"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub Mostrar_detalle()
    Dim t As DAO.Recordset
    Dim subelemento As ListItem
    Set t = Base.OpenRecordset("select *from  Hematologiasop order by n")
    ListView1.ListItems.Clear
    While Not t.EOF
        Set subelemento = ListView1.ListItems.Add(, , t(0))
        subelemento.SubItems(1) = t(1)
        t.MoveNext
    Wend
End Sub

Private Sub Command1_Click()
    Unload Me
End Sub

Private Sub Command3_Click()
    x = InputBox("Campo")
    v = InputBox("Valor")
    t = MdlFunciones.AutoNumero("n", "hematologiasop")
    Base.Execute "insert into hematologiasop(campo,valor,n) values(" _
    & "'" & x & "'," _
    & "'" & v & "'," _
    & "" & t & ")"
    Mostrar_detalle

    
    
    
End Sub

Private Sub Command4_Click()
    dato = ListView1.SelectedItem
    valor = ListView1.SelectedItem.ListSubItems(1)
    Dim rs As DAO.Recordset
    Dim rant As DAO.Recordset
    Set rs = Base.OpenRecordset("select *from HematologiasOP where valor='" & valor & "' and campo='" & dato & "'")
    If Not rs.EOF Then
        n = val(rs("n"))
            nuevan = n - 1
            If nuevan >= 0 Then
                Base.Execute "update hematologiasOP set n=999 where n=" & n
                Base.Execute "update hematologiasOP set n=" & n & " where n=" & nuevan
                Base.Execute "update hematologiasOP set n=" & nuevan & " where n=" & 999
                Me.Mostrar_detalle
            End If
        End If
End Sub

Private Sub Command5_Click()
    dato = ListView1.SelectedItem
    valor = ListView1.SelectedItem.ListSubItems(1)
    Dim rs As DAO.Recordset
    Dim rant As DAO.Recordset
    Set rs = Base.OpenRecordset("select *from HematologiasOP where valor='" & valor & "' and campo='" & dato & "'")
    If Not rs.EOF Then
        n = val(rs("n"))
            nuevan = n + 1
            If nuevan >= 0 Then
                Base.Execute "update hematologiasOP set n=999 where n=" & n
                Base.Execute "update hematologiasOP set n=" & n & " where n=" & nuevan
                Base.Execute "update hematologiasOP set n=" & nuevan & " where n=" & 999
                Me.Mostrar_detalle
            End If
    End If

End Sub

Private Sub Form_Load()
    Mostrar_detalle
End Sub

Private Sub ListView1_DblClick()
    cam = ListView1.SelectedItem
    frmCambiar.Text1.Text = ListView1.SelectedItem
    frmCambiar.Text2.Text = ListView1.SelectedItem.ListSubItems(1)
    frmCambiar.Show vbModal
    If frmCambiar.OP <> "-1" Then
        Base.Execute "update Hematologiasop set valor='" & frmCambiar.valor & "', campo='" & frmCambiar.OP & "' where  campo='" & cam & "' and valor='" & ListView1.SelectedItem.ListSubItems(1) & "'"
        Mostrar_detalle
    End If


End Sub
